﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using KELT.KELTObjects.ViewportObjectModel;

namespace KELT.KELTObjects.LibraryObjectModel
{
    public class MultimediaObj : KELT_OBJ
    {
        #region Param
        protected string m_fileFullPath;
        protected string m_filePath;
        protected string m_fileName;
        protected string m_fileExt;
        #endregion

        #region Get/Set
        public string fileFullPath
        {
            get
            {
                return m_fileFullPath;
            }

            set
            {
                m_fileFullPath = Path.GetFullPath(value);

                m_filePath = Path.GetDirectoryName(m_fileFullPath);
                m_fileName = Path.GetFileNameWithoutExtension(m_fileFullPath);
                m_fileExt = Path.GetExtension(m_fileFullPath);


                for (int i = 0; i < viewportObjectList.Count; i++)
                {
                    (viewportObjectList[i] as PictureObject).setImage(value);
                }
            }
        }

        public string filePath
        {
            get
            {
                return m_filePath;
            }
        }

        public string fileName
        {
            get
            {
                return m_fileName;
            }
        }

        public string fileExt
        {
            get
            {
                return m_fileExt;
            }
        }
        #endregion

        #region XML
        public override void GetObjInfoXML(XmlWriter writer)
        {
            writer.WriteStartElement("MultimediaObj");
            {
                writer.WriteElementString("fileFullPath", fileFullPath);
            }
            writer.WriteEndElement();
        }
        #endregion
    }
}
